package org.dtrd.modules.food.entity.po;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.food.entity.bean.CookbookCategoryDetail;

import java.util.Date;


/**
 * <p>
 * 菜谱分类
 * </p>
 *
 * @author QR
 * @since 2021-12-09
 */
@Getter
@Setter
@TableName("dtrd_ext_ems_yw_cookbook_category")
public class DtrdExtEmsYwCookbookCategory {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    /**
     * 分类名称
     */
    @TableField("category_name")
    private String categoryName;

    /**
     * 分类描述
     */
    @TableField("category_desc")
    private String categoryDesc;

    /**
     * 创建时间
     */
    @TableField("category_create_time")
    private Date categoryCreateTime;

    @TableField("category_thumb")
    private String categoryThumb;

    public DtrdExtEmsYwCookbookCategory init() {
        isDel = 0;
        categoryCreateTime = new Date();
        return this;
    }

    public DtrdExtEmsYwCookbookCategory parseFromDto(CookbookCategoryDetail dto) {
        dataId = dto.getDataId();
        categoryName = dto.getCategoryName();
        categoryDesc = dto.getCategoryDesc();
        categoryCreateTime = dto.getCategoryCreateTime();
        categoryThumb = dto.getCategoryThumb();
        return this;
    }


}
